package com.itheima.mapper;

import com.itheima.pojo.Student;
import com.itheima.pojo.StudentQueryParam;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

@Mapper
public interface StudentMapper {

    List<Student> findAll(StudentQueryParam s);

    @Delete("delete from student where id = #{id} ")
    void deleteById(Integer id);


    void insert(Student student);

    @Select("select * from student where id = #{id}")
    Student findById(Integer id);

    void update(Student student);


    void updateViolation(Integer id, Integer score);


    List<Map<String, Object>> getStudentDegreeData();

    List<Map<String, Object>> getStudentCountData();

    @Select("select count(*) from student where clazz_id = #{id}")
    Integer countStudentsByClassId(Integer id);
}
